package initialize

import (
	"biliPushServer/controller"
	_ "biliPushServer/docs"
	"biliPushServer/middleware"

	"github.com/gin-gonic/gin"
	ginSwagger "github.com/swaggo/gin-swagger"
	"github.com/swaggo/gin-swagger/swaggerFiles"
)

// InitRouter : 初始化全局路由
func InitRouter() *gin.Engine {
	var app = gin.Default()
	app.Use(middleware.Cors())
	app.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
	// 注册路由
	regRouters(app)
	return app
}

func regRouters(router *gin.Engine) {
	APIRouter := router.Group("")
	new(controller.Upload).Router("upload", APIRouter)
}
